﻿using System;

namespace NextDate
{
    class NextDate
    {
        static void Main()
        {
            int day = int.Parse(Console.ReadLine());
            int month = int.Parse(Console.ReadLine());
            int year = int.Parse(Console.ReadLine());

            DateTime userTime = new DateTime(year, month, day);
            DateTime epochTime = new DateTime(1970, 1, 1);

            TimeSpan diff = (userTime - epochTime);
            int tomorrow = (int)((diff.TotalMilliseconds/1000)+86400);

            //var date = new DateTime(tomorrow, DateTimeKind.Utc);
            DateTime x = new DateTime(1970, 1, 1).AddSeconds(tomorrow);
            Console.WriteLine(x.ToString("d.M.yyyy"));
        }
    }
}
